package com.cy.核心编程.thead.basic.yield;

/**
 * 让出CPU，让别人执行
 */
public class MyThread extends Thread{
    public MyThread(String name){
        super.setName(name);
    }

    @Override
    public void run() {
        for (int i = 0; i < 500; i++) {
            System.out.println(super.getName()+":"+i);
            if(i % 10 == 0){
                Thread.yield();
            }
        }
    }
}
